package com.lul15834.orderfood.activity.user.listen;

import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.lul15834.orderfood.R;
import com.lul15834.orderfood.activity.user.UserComment;

public class StartListen implements View.OnClickListener {
    private UserComment userCommentClass;

    public StartListen(UserComment userCommentClass) {
        this.userCommentClass=userCommentClass;
    }

    @Override
    public void onClick(View v) {
        int id = v.getId();
        ImageView img= (ImageView) v;
        String conZ[]={"非常差","差","一般","满意","非常满意"};//代表五个内容
        //将所有的都设置成星星、点击之后
        int icoIdZ[]={R.id.user_comment_one,
                R.id.user_comment_two,R.id.user_comment_three,
                R.id.user_comment_four,R.id.user_comment_five};
        TextView con=userCommentClass.findViewById(R.id.user_comment_con);
        int a=0;
        for (int i=0;i<icoIdZ.length;i++){
            if(id==icoIdZ[i]){
                a=1;
                con.setText(conZ[i]);
            }
            ImageView imageView=userCommentClass.findViewById(icoIdZ[i]);
            if (a==0){
                imageView.setImageResource(R.drawable.xx);
            }else {
                imageView.setImageResource(R.drawable.wxx);
            }
            img.setImageResource(R.drawable.xx);
        }
    }
}
